import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
// 拖拽排序
import VueDND from 'awe-dnd'
import { VueJsonp } from 'vue-jsonp'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/style/reset.scss'
import './assets/style/font.scss'
import './assets/style/public.scss'
import './assets/style/rocket-base.scss'

import { $http } from './plugins/httpReq'

// 引入全局组件注册
import './components'
Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(VueDND)
Vue.use(VueJsonp)
Vue.prototype.$http = $http
Vue.prototype._versition = '1.3.9'
Vue.prototype._pageSize = 30 // 默认查询条数
Vue.prototype._pageSizes = [10, 20, 30, 50, 100] // 默认分页码器
Vue.prototype._devGameList = [
    {
        appName: '王者荣耀',
        gameid: 1377
    },
    {
        appName: '和平精英',
        gameid: 1462
    },
    {
        appName: '火影忍者-疾风传',
        gameid: 1154
    }
]
Vue.prototype._proGameList = [
    {
        appName: '王者荣耀',
        gameid: 1014
    },
    {
        appName: '和平精英',
        gameid: 1015
    },
    {
        appName: '火影忍者',
        gameid: 1028
    }
]
Vue.filter('sizeFilter', (data) => {
    if (!data) {
        return '/'
    }
    let size = data / 1024
    if (size <= 1024) {
        size = size.toFixed(2)
        return size + ' KB'
    } else {
        size = size / 1024
        if (size <= 1024) {
            size = size.toFixed(2)
            return size + ' MB'
        } else {
            size = size / 1024
            size = size.toFixed(2)
            return size + ' GB'
        }
    }
})
Vue.filter('timeNo0', (time) => {
    if (time && time.includes('.0')) {
        return time.split('.0')[0]
    } else {
        return time
    }
})

Vue.filter('numInit', (val = 0) => {
    if (val >= 10000) {
        return (Math.floor(val / 1000) / 10) + 'w'
    } else if (val >= 1000) {
        return (Math.floor(val / 100) / 10) + 'k'
    } else {
        return val
    }
})
Vue.filter('numInitW', (val = 0) => {
    if (val >= 10000) {
        return (Math.floor(val / 1000) / 10) + 'w'
    } else {
        return val
    }
})

Vue.filter('coinInitMoney', (val = 0) => {
    console.log(val, Math.floor(val / 10000))
    return (val / 10000).toFixed(2) + '元'
})

Vue.filter('qbsInitMoney', (val = 0) => {
    return (val / 100).toFixed(2) + '元'
})

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')
